package com.example.blog.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * <p>
 * 文章信息
 * </p>
 *
 * @author wlh
 * @since 2024-01-10
 */
@Getter
@Setter
@TableName("article")
@Document(indexName = "article")
public class Article implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 文章ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Id
    private Long id;

    /**
     * 文章标题
     */
    @TableField("title")
    @Field(type = FieldType.Text)
    private String title;

    /**
     * 文章封面
     */
    @TableField("images")
    private String images;

    /**
     * 文章摘要
     */
    @TableField("summary")
    @Field(type = FieldType.Text)
    private String summary;

    /**
     * 文章内容
     */
    @TableField("content")
    private String content;

    /**
     * 文章标签
     */
    @TableField("tags")
    @Field(type = FieldType.Text)
    private String tags;

    /**
     * 文章分类
     */
    @TableField("type")
    private String type;

    /**
     * 创建人ID
     */
    @TableField(value = "created_by", fill = FieldFill.INSERT)
    private Long createdBy;

    /**
     * 修改人ID
     */
    @TableField(value = "updated_by", fill = FieldFill.INSERT_UPDATE)
    private Long updatedBy;

    /**
     * 创建时间
     */
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    private Date createdTime;

    /**
     * 更新时间
     */
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;

    /**
     * 浏览量
     */
    @TableField("views")
    private Integer views;

    /**
     * 收藏数量
     */
    @TableField("favorites")
    private Integer favorites;

    /**
     * 点赞量
     */
    @TableField("likes")
    private Integer likes;

    /**
     * 状态：0：草稿箱，1：待审核，2：已发布，3：驳回
     */
    @TableField("status")
    private Integer status;

    /**
     * 驳回原因
     */
    private String message;
}
